package com.bjwl.web.contrlller.branchstore;

import com.bjwl.pojo.Bsadmin;
import com.bjwl.pojo.Daily;
import com.bjwl.service.DailyService;
import com.bjwl.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @Author: czc
 * @Date:Create：in 2020/4/19 23:41
 * @Description:
 * @Modified By：
 * @Version: 1.0
 */
@Controller
@RequestMapping("/BsD")
public class BsDailyController {

    @Autowired
    private DailyService dailyService;

    @RequestMapping("/brFindAllDaily")
    public String brFindAllDaily(HttpSession httpSession,Integer bsid,Integer pageNum , String content){
        if(pageNum == null){
            pageNum =1;
        }
        Bsadmin bsadmin1 = (Bsadmin) httpSession.getAttribute("bsadmin1");
        bsid = bsadmin1.getBsid();
        PageBean<Daily> dailyList = dailyService.brFindAllDaily(pageNum,bsid,content);
        httpSession.setAttribute("dailyList",dailyList);
        return "redirect:/br/log-list";
    }

    @RequestMapping("/addBsDaily")
    public @ResponseBody
    Boolean addBsDaily(@RequestBody Daily daily){
        dailyService.addDaily(daily);
        return true;
    }

}
